/************************************************************************************
* ArtistModel.h                                                                        *
*                                                                                   *
* Copyright (C) 2011 Varuna L Amachi                                              *
*                                                                                   *
* This program is free software; you can redistribute it and/or modify              *
* it under the terms of the GNU General Public License as published by              *
* the Free Software Foundation; either version 2 of the License, or any             *
* later version.                                                                    *
*                                                                                   *
* This program is distributed in the hope that it will be useful, but               *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY        *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for       *
* more details. You should have received a copy of the GNU General Public           *
* License along with this program; if not, write to the Free Software Foundation,   *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                       *
*                                                                                   *
*************************************************************************************/ 

#ifndef ARTISTMODEL_H
#define ARTISTMODEL_H

#include <QAbstractItemModel>
#include <QString>
#include "collector/Collector.h"
#include "collector/Types.h"
#include "collector_common/SimpleCollectionSortFilter.h"
#include "interfaces/YContext.h"


class ArtistModel : public QAbstractItemModel
{
    Q_OBJECT
    QList<ArtistInfo *> m_artists;
//    float getArtistAvgRating(ArtistInfo *artist) const;

public:
    ArtistModel(QObject *parent = 0);
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    QModelIndex index(int row, int column, const QModelIndex &parent) const;
    QModelIndex parent(const QModelIndex &child) const;
    bool hasChildren(const QModelIndex &parent) const;

public slots:
    void setModel(QList<ArtistInfo *> model);
};


class ArtistSortFilterModel : public SimpleCollectionSortFilter {
public:
    explicit ArtistSortFilterModel(Yamp::YContext *context, QObject *parent = 0)
        : SimpleCollectionSortFilter(context, parent){}
    bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
};

#endif // ARTISTMODEL_H
